package com.flying.invest.strategy.model;

import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.ServiceField;
import com.flying.framework.annotation.ServiceFieldParam;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;
import com.flying.invest.assets.model.Assets;
import com.flying.invest.invest.model.Investment;

@SuppressWarnings("serial")
@Meta(id="i_strategy_invest_monitor",title="", table="i_strategy_invest_monitor", primaryKeys={"strategy_id"})
public class StrategyInvestMonitor extends Strategy implements DataSerializable {
	public final static String ENTITY_NAME = "i_strategy_invest_monitor";
	
	public final static String STRATEGY_ID = "strategy_id";
	public final static String INVEST_STATUS = "invest_status";
	public final static String ASSETS_TYPE_ID = "assets_type_id";
	public final static String ASSETS_MARKET_ID = "assets_market_id";
	public final static String ASSETS_BLOCK_ID = "assets_block_id";
	public final static String MAX_PROFIT_RATE = "max_profit_rate";
	public final static String MAX_LOSS_RATE = "max_loss_rate";
	public final static String CHECK_LIMIT_RATE = "check_limit_rate";
	public final static String COMMISSION_RATE = "commission_rate";
	
	
	@Param(value=STRATEGY_ID, required=true, desc="策略ID" )
	private Long strategyId;
	
	@Param(value=INVEST_STATUS, required=false, desc="状态", enumClass=Investment.Status.class )
	private Integer investStatus;
	
	@Param(value=ASSETS_TYPE_ID, required=false, desc="类型ID" )
	private Long assetsTypeId;
	
	@Param(value=ASSETS_MARKET_ID, required=false, desc="市场ID" )
	private Long assetsMarketId;
	
	@Param(value=ASSETS_BLOCK_ID, required=false, desc="板块ID" )
	private Long assetsBlockId;
	
	@Param(value=MAX_PROFIT_RATE, required=false, desc="最高盈利率" )
	private Double maxProfitRate;
	
	@Param(value=MAX_LOSS_RATE, required=false, desc="最大回撤率" )
	private Double maxLossRate;
	
	@Param(value=CHECK_LIMIT_RATE, required=false, desc="是否检查配额" )
	private Integer checkLimitRate;
	
	@Param(value=COMMISSION_RATE, required=true, desc="委托比例" )
	private Double commissionRate;
	//
	@ServiceField(serviceId="InvestmentService:findById", params={@ServiceFieldParam(param=Investment.INVEST_ID, value="$"+INVEST_ID)})
	@Param(value="invest",   required=false,	desc="资产", ignored=true)
	private Investment invest;
	
	public Long getStrategyId() {
		return this.strategyId;
	}
	
	public void setStrategyId(Long strategyId) {
		this.strategyId = strategyId;
	}
	
	public Integer getInvestStatus() {
		return this.investStatus;
	}
	
	public void setInvestStatus(Integer investStatus) {
		this.investStatus = investStatus;
	}
	
	public Long getAssetsTypeId() {
		return this.assetsTypeId;
	}
	
	public void setAssetsTypeId(Long assetsTypeId) {
		this.assetsTypeId = assetsTypeId;
	}
	
	public Long getAssetsMarketId() {
		return this.assetsMarketId;
	}
	
	public void setAssetsMarketId(Long assetsMarketId) {
		this.assetsMarketId = assetsMarketId;
	}
	
	public Long getAssetsBlockId() {
		return this.assetsBlockId;
	}
	
	public void setAssetsBlockId(Long assetsBlockId) {
		this.assetsBlockId = assetsBlockId;
	}
	
	public Double getMaxProfitRate() {
		return this.maxProfitRate;
	}
	
	public void setMaxProfitRate(Double maxProfitRate) {
		this.maxProfitRate = maxProfitRate;
	}
	
	public Double getMaxLossRate() {
		return this.maxLossRate;
	}
	
	public void setMaxLossRate(Double maxLossRate) {
		this.maxLossRate = maxLossRate;
	}
	
	public Integer getCheckLimitRate() {
		return this.checkLimitRate;
	}
	
	public void setCheckLimitRate(Integer checkLimitRate) {
		this.checkLimitRate = checkLimitRate;
	}
	
	public Double getCommissionRate() {
		return this.commissionRate;
	}
	
	public void setCommissionRate(Double commissionRate) {
		this.commissionRate = commissionRate;
	}
	
	//
	public Investment getInvest() {
		return this.invest;
	}
	
	public String getInvestName() {
		var v = this.getInvest();
		return v == null? null: v.getName();
	}
}